package com.ttsx.core.common.constant;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author wb
 * @since 2025-11-07
 */

@Component
public class AlipayConstants implements InitializingBean {

    @Value("${alipay.appId}")
    private String appId;
    @Value("${alipay.privateKey}")
    private String privateKey;
    @Value("${alipay.publicKey}")
    private String publicKey;
    @Value("${alipay.notifyUrl}")
    private String notifyUrl;
    @Value("${alipay.returnUrl}")
    private String returnUrl;
    @Value("${alipay.signType}")
    private String signType;
    @Value("${alipay.charset}")
    private String charset;
    @Value("${alipay.gatewayUrl}")
    private String gatewayUrl;

    public static String APP_ID;
    public static String PRIVATE_KEY;
    public static String PUBLIC_KEY;
    public static String NOTIFY_URL;
    public static String RETURN_URL;
    public static String SIGN_TYPE;
    public static String CHARSET;
    public static String GATEWAY_URL;

    @Override
    public void afterPropertiesSet() throws Exception {
        APP_ID = appId;
        PRIVATE_KEY = privateKey;
        PUBLIC_KEY = publicKey;
        NOTIFY_URL = notifyUrl;
        RETURN_URL = returnUrl;
        SIGN_TYPE = signType;
        CHARSET = charset;
        GATEWAY_URL = gatewayUrl;
    }
}
